3D CONCEPTS

All 3D modeling programs are different: they differ in the terminology of their manuals, the way they represent materials and textures, and in the way that data renders to the screen.

This chapter provides a cosmological view of 3D models and modeling programs. This background can help you understand the differences between 3D programs and the compromises required by translators such as Interchange.

Coordinate systems
The disagreements begin at the simplest level. "Three dimensional" often implies three mutually perpendicular axes of direction, commonly labeled X, Y and Z.

Interchange maintains the convention of the "X" direction being to the left and right, "Y" into and out of the screen, and "Z" up and down. For example, this is the convention in the text generated by the Statistics Converter. Other programs differ: LightWave, for example, has "Y" meaning up and down with "Z" being in and out of the screen. Other programs might label the axes the same way, but disagree in the choice of direction of the positive Y direction, or disagree in the definition of positive and negative rotation angles. Some programs let you change the labelling of the axes in the user interface although the internal format uses a different system.

The software industry is not immune to a lack of standard notations. Examine any three books on computer graphics or computer mathematics. They probably don't agree on these conventions, either.

Interchange resolves these disagreements, insuring that converted objects have the same orientation. This question also arises when converting a 2D drawing into 3D. Should the flat drawing be placed on the floor or a wall?

Points
The fundamental entity of 3D models is the point. The terms "point," "coordinate" and "vertex" have precise definitions but are often used Interchangeably. The dictionary describes "point" as a location in space. A "vertex" is the point where the sides of an angle meet. Plural forms are "vertexes" and "vertices." "Vertice" singular may not be a real word.

The location of a point is specified as three numbers, the distance along the X, Y and Z coordinate axes. These three values define the point in space.

There are many ways to represent coordinate values in a file. The easiest to understand is an ASCII representation, such as the stream of bytes "3.14159" found in an AutoCAD DXF file.

The microprocessor is more comfortable performing math using two bytes to represent integers between 0 and 65,335, or four byte integers to store values between 0 and 4,294,967,295. "Floating point" systems re-interpret those four bytes in a different way to represent values that have both an integer and fractional part. Floating point values come in standard formats such as IEEE-754 or Motorola FFP "fast floating point."

Each 3D program uses a number format suited to its function, chosen by the program's designers. Converting between different number systems can lead to round-off errors or inaccuracies in the geometry of an object. Converting a floating-point object to an integer format is difficult without compromise. In some 3D file formats, it might be impossible to represent an object that is both large (in dimension, not file size) and yet accurate in small details.

Edges and Polygons
Edges are the sides of polygons. Interchange uses the term "polygon" to describe the area between those edges. Other programs use the word "face" and "polygon" interchangeably.

Many 3D programs keep separate lists for points, edges, and polygonal faces. When you create a polygon, its points and edges are automatically added to the database.

Different 3D bookkeeping methods lead to incompatibilities when translating between 3D programs. Connect two points in space by a straight line, and you have an edge or side. There is a clear relationship between the number of sides in a polygon and the number of points in the polygon: a triangle has three points, a square has four, a pentagon has five, etc.

Some programs allow you to create points and edges that are very much a part of the model, but not part of any polygon. Interchange will interpret these "lone points" and "lone edges" as polygons with one and two sides, respectively.

Not all programs support these ideas of polygons. Some programs support only triangles while others allow polygons with up to five sides, while others allow up to 65,000 sides. For example, 3D Studio and Imagine restrict objects to triangles. To make a square, you need two adjacent triangles. 3D Studio can hide the diagonal edge, making these two triangles appear like a square.

Each 3D program has its own limits. For example, one program might limit objects to 32,767 points while another allows 65,535 points. It might not be possible to convert an object between these formats.

For example, compare the way LightWave, Sculpt, and 3D Studio represent 3D data: LightWave keeps lists of points and polygons, but no edges. Instead of separate edges, it allows "polygons" with just one or two points, as well as polygons with three or more points. One-point polygons render to the screen as a visible point covering one or more pixels, as if the point had volume. Two-point polygons render as lines of one or more pixels in width. Three and many-point polygons render as solid areas.

Sculpt keeps separate lists of points, edges and triangular polygons. It is possible to make lone points and lone edges that are not part of any polygon. In the editor, Sculpt shows all the points and edges, but polygons are only visible from their points and edges. In wireframe rendering, only edges are drawn. In other rendering modes, only polygons appear.

3D Studio keeps lists of points and triangular polygons. Only triangles can be stored and rendered, although the visibility of edges in polygons can be controlled for editing purposes.

In some programs, very thin polygons always render as at least one pixel wide on the screen. In others, thin polygons disappear as they move farther from the camera.

Triangulation
When converting from a format that allows many-sided polygons to a format that requires triangles, Interchange reduces the complex polygon to triangles with the same outline as the original polygon. It is always possible to do this without increasing the number of points in the object. The resulting triangles are given the same outward normal as the original polygon.

On the other hand, when converting a triangle-based object to a format that allows both triangles and many-sided polygons, in most cases Interchange does not automatically join adjacent triangles to form polygons with more sides.

For example, if you create a square object in Wavefront by placing two triangles next to each other, Interchange doesn't convert the two triangles to a LightWave polygon with four sides.

There are several reasons why the triangular version may be superior. Depending on the program's rendering technique, a many-sided region may render more accurately when broken down into triangles. The many-sided polygon is more likely to disappear behind another polygon, or in front of another object that is actually behind it. Some programs determine depth (and therefore layering and rendering order) based on an average center point instead of true intersections between polygons.

Orientation
Some programs require polygons to have a particular orientation or "outward normal," usually controlled by the order in which a polygon's points are created. These polygons are only visible from one direction. For example, LightWave requires the points listed in counter-clockwise order, looking at the polygon from the "outside" direction.

Polygon orientation does not concern some programs. Other programs have options to set materials as "double-sided," meaning both sides are visible. Converting an object with randomly oriented polygons to a format that requires orientation can be solved in any case by doubling the polygons by creating copies of each polygon, listed in the opposite order.

Smoothing
The way a 3D program stores 3D objects also affects the smoothing of polygons. Some smoothing algorithms depend on connectivity information to determine if the shared border between two polygons should be smoothed. If two polygons are set as smooth and the program's database confirms they are adjacent, then the border renders smoothly. Some programs generate this connectivity information automatically as objects are built, but they usually provide a way to change the connectivity.

A common method of checking if two polygons are adjacent is by asking the database to see if they have any points in common. Instead of comparing three (X, Y and Z) coordinates for each point, programs compare the indexes of the polygon's points in the point list. For example, if both polygons share points 10 and 30, then their common boundary is smoothed.

Similarly, hard (not smoothed) boundaries can be enforced by creating points that have the same X, Y, Z location as other points, but with different indexes in the point list. Two polygons might have points in common in space, but the points don't have the same index in the point list, therefore, the program doesn't think they're the same point. Some programs use the terms "welded" and "unwelded" to describe this situation.

Material attributes
Each 3D program describes material attributes in different ways, too. Interchange uses the term "material" to describe the collection of settings that affect the appearance of polygons.

At the simplest level, polygons have color, usually set in terms of red, green and blue. Some programs allow an unlimited number of materials, others are restricted to limited palettes. Most programs extend material definitions to include the color of reflected light, the amount of transparency to the object, the color of light after it passes through a transparent object, how much light bends or refracts while passing through an object, and the size and color of shiny highlights, and many other attributes. Most programs can wrap bitmap images onto objects, creating a texture map.

Interchange's materials are very similar to those used in today's most popular programs. For a complete description, see the "Interchange Objects" chapter.

Hierarchies
Most 3D programs allow you to build a hierarchy of objects. For example, a humanoid object could have separate objects for the arms, legs, torso and head. Each moves independently, but when you move the torso, the entire human moves together. When you rotate an upper arm, only the upper arm, forearm and hand rotate.

Not all 3D programs store an entire hierarchy in a single file. When converting a hierarchical object to a format that does not support separable hierarchies, Interchange coalesces the sub-objects into a single object. Also, some programs might allow an object to be composed of separate pieces, but no hierarchy is implied - for example, AutoCAD uses "layers" to arrange a drawing.

Other object data types
Interchange is good at translating data made of 3D polygonal polygons. Most photorealistic 3D programs represent all objects with polygonal faces. Ray-tracing programs typically focus on mathematically defined objects such as spheres, cones and cylinders. Some programs allow a mix of polygon-based and math-based objects.

Interchange does not translate splines and patches or NURBS surfaces.
Interchange does not translate object motions or constraints.